﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Catering.Catering_Page.system
{
    public partial class ZhanBan_Notice : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Catering_Model.Announcement model = new Catering_Rules.Announcement().GetZhanBanModel();
                if (model != null && !string.IsNullOrEmpty(model.Conent))
                {
                    div_hi_id.Value = model.id.ToString();
                    ftxt_Conent.Value = model.Conent;
                }
            }
        }

        protected void btnInfoAdd_Click(object sender, EventArgs e)
        {
            Catering_Model.Announcement model = new Catering_Model.Announcement();
            model.Conent = ftxt_Conent.Value;
            model.Release = DateTime.Now;
            model.UserId = Convert.ToInt32(Session["UserID"].ToString());
            model.temp2 = "1";
            try
            {
                model.id = Convert.ToInt32(div_hi_id.Value);
                new Catering_Rules.Announcement().Update(model);
            }
            catch
            {
                new Catering_Rules.Announcement().Add(model);
            }
            View_Operaction_Common.Show(this, "提交成功！");
        }
    }
}